<template>
	<view class="onebox">
		<view class="order" v-for="(item,index) in MyZanList" :key="index">
			<view class="box1">
				<view class="box1" style="flex: 1;">
					<view class="">
						<image style="height: 80rpx; width: 80rpx; border-radius: 50%;" :src="item.avatar" mode="">
						</image>
					</view>
					<view class="" style="margin-left: 15rpx;">
						<view class="" style="font-size: 28rpx; font-weight: 600;">
							{{item.nickname}}
						</view>
					</view>
				</view>

				<image class="img1" src="../../static/good.png" mode=""></image>
			</view>
			<view class="text-tz">
				<!-- 赞帖子的 -->
				<view @click="tzDetalis(item.tz.id)" v-if="item.type==1" class="box2">
					<image v-if="item.tz.images!=''"
						style="height: 50rpx; width: 50rpx; border-radius: 8rpx; margin-right: 20rpx;"
						:src="item.tz.images.split(',')[0]" mode=""></image>
					<text v-if="item.tz.nav_name">#{{item.tz.nav_name}}#</text>
					{{item.tz.content}}

				</view>
				<!-- 赞评论 -->
				<view @click="tzDetalis(item.cm.tz_id)" v-if="item.type==2&&item.cm!=null" class="box2">
					<image v-if="item.cm.image!=''"
						style="height: 50rpx; width: 50rpx; border-radius: 8rpx; margin-right: 20rpx;"
						:src="item.cm.image" mode=""></image>
					{{item.cm.content}}
				</view>
				<view v-if="item.type==2&&item.cm==null" class="box2">
					评论已删除
				</view>
			</view>
		</view>
		<view class="nomore">没有了</view>
	</view>
</template>

<script>
	import $api from '../../common/request3.js'
	export default {
		data() {
			return {
				MyZanList: [],
				page: '1',
				"isHas": true,
			}
		},
		onLoad() {
			this.openid = uni.getStorageSync('openid');
			this.key = uni.getStorageSync('key');
			this.GetMyZanList('reset')
		},
		methods: {
			onReachBottom() {
				this.page++;
				this.GetMyZanList('add')
			},
			GetMyZanList(type) {
				if (type == "reset") {
					this.CommentList = [];
					this.page = 1;
				}
				$api.request({
					url: "lt/getMyZanList",
					method: 'POST',
					data: {
						key: this.key,
						openid: this.openid,
						page: this.page
					}
				}).then((res) => {
					let arr = res.data || [];
					this.isHas = arr.length > 10;
					arr.map(item => {
						this.MyZanList.push(item)
					})
					console.log(this.MyZanList, '55555')
				}).catch((res) => {
					uni.showToast({
						title: res.msg,
						icon: "none"
					})
				})
			},
			tzDetalis(id) {
				uni.navigateTo({
					url: `/pages/index/details?tz_id=${id}`
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.onebox {
		min-height: 100vh;
		background-color: #F6F7F8;
	}

	.order {
		background-color: #fff;
		padding: 26rpx;
		margin-bottom: 10rpx;

		.box1 {
			display: flex;
			align-items: center;

			.img1 {
				width: 30rpx;
				height: 30rpx;
				margin-left: 10rpx;
			}
		}

		.text-tz {
			background-color: #F6F7F8;
			margin-top: 20rpx;
			border: 6rpx;
			color: #A3A2A2;
			padding: 16rpx;
			font-size: 26rpx;
		}
	}

	.box2 {
		display: flex;
		align-items: center;
	}

	.box3 {
		display: flex;
		// align-items: center;
		flex-direction: column;
	}
</style>